using UnityEngine;
using System.Runtime.CompilerServices;
using System.Threading;

namespace LP
{
    public abstract class UISub : ILifecycle, IUIBase, IUpdate, ICanUpdate
    {
        public bool IsUpdate { get; set; } = false;
        protected Transform RootTrans { get; }
        protected CancellationTokenSource TokenSource { get; }
        public UISub(Transform rootTrans, CancellationTokenSource tokenSource)
        {
            RootTrans = rootTrans;
            TokenSource = tokenSource;
        }

        public virtual void OnDestroy()
        {
        }

        public virtual void OnHide(ITuple tuple = null)
        {
        }

        public virtual void OnHideBefore()
        {
        }

        public virtual void OnInit()
        {
        }

        public virtual void OnInitFinish()
        {
        }

        public virtual void OnShow(ITuple tuple = null)
        {
        }

        public virtual void OnShowBefore()
        {
        }

        public virtual void OnUpdate(float delta)
        {
        }
    }
}